package J20250227_dfs;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description: 正则问题
 * User: 王圆豪
 * Date: 2025-03-11
 * Time: 23:44
 */
public class Main1 {
    static String s = null;
    static int pos = -1;
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        s = scan.nextLine();
        System.out.print(dfs());
        scan.close();
    }
    public static int dfs(){
        int max = 0;
        int cur = 0;
        while(pos < s.length()-1){
            pos++;
            if(s.charAt(pos) == '('){
                cur += dfs();
            }else if(s.charAt(pos) == '|'){
                max = Math.max(cur,max);
                cur=0;
            }else if(s.charAt(pos) == 'x'){
                cur++;
            }else break;
        }
        return Math.max(max,cur);
    }
}